package task2;

import java.util.ArrayList;
import java.util.Scanner;


public class test6 {//单向链表解决小明魔术问题

    static Scanner input=new Scanner(System.in);
    static ArrayList<Integer> list=new ArrayList<>();
    static Node end;
    static int numOfCards;
    static int point;


    public static void main(String[] args) {
        numOfCards=input.nextInt();
        point=numOfCards-1;

        if (numOfCards>13)
            numOfCards=13;
        if(numOfCards<1)
            numOfCards=1;

        create(numOfCards);
        reSet();
    }
    private static void create(int length){
        for(int i=1;i<=length;i++)
            list.add(i);
    }
    private static void reSet(){

        Node bottom;
        end=new Node(list.get(point));//创建尾部节点
        point--;
        bottom=end;

        while (point>=0){
            Node body=new Node(list.get(point));//将新节点放在最底部
            bottom.pre=body;


            Node last=end.pre;

            body.pre=end;
            bottom=end;
            bottom.pre=null;


            point--;
            end=last;
        }
        print();
    }
    private static void print() {
        list.clear();
        while (end!=null){
            list.add(end.value);
            end=end.pre;
        }
        for(int i=list.size()-1;i>=0;i--){
            if(i==0){
                System.out.print(list.get(i));
            }else{
                System.out.print(list.get(i)+",");
            }
        }


    }
}
class Node{
    Node pre;
    int value;

    public Node(int value){
        this.value=value;
    }
}